package com.party.core.service.analysis.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.analysis.StatisticsEventFlowReadDao;
import com.party.core.dao.write.analysis.StatisticsEventFlowWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.analysis.StatisticsEventFlow;
import com.party.core.service.analysis.IStatisticsEventFlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @program: party-temp
 * @description: 统计事件流程接口实现
 * @author: Huaqunhao
 * @create: 2018-08-01 11:57
 **/

@Service
public class StatisticsEventFlowService implements IStatisticsEventFlowService {

    @Autowired
    private StatisticsEventFlowReadDao statisticsEventFlowReadDao;
    @Autowired
    private StatisticsEventFlowWriteDao statisticsEventFlowWriteDao;

    @Override
    public String insert(StatisticsEventFlow statisticsEventFlow) {
        BaseModel.preInsert(statisticsEventFlow);
        boolean result = statisticsEventFlowWriteDao.insert(statisticsEventFlow);
        if (result) {
            return statisticsEventFlow.getId();
        }
        return null;
    }

    @Override
    public boolean update(StatisticsEventFlow statisticsEventFlow) {
        statisticsEventFlow.setUpdateDate(new Date());
        return statisticsEventFlowWriteDao.update(statisticsEventFlow);
    }

    @Override
    public boolean deleteLogic(String id) {
        return false;
    }

    @Override
    public boolean delete(String id) {
        return statisticsEventFlowWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return false;
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return false;
    }

    @Override
    public StatisticsEventFlow get(String id) {
        return statisticsEventFlowReadDao.get(id);
    }

    @Override
    public List<StatisticsEventFlow> listPage(StatisticsEventFlow statisticsEventFlow, Page page) {
        return statisticsEventFlowReadDao.listPage(statisticsEventFlow, page);
    }

    @Override
    public List<StatisticsEventFlow> list(StatisticsEventFlow statisticsEventFlow) {
        return null;
    }

    @Override
    public List<StatisticsEventFlow> batchList(Set<String> ids, StatisticsEventFlow statisticsEventFlow, Page page) {
        return null;
    }

    @Override
    public List<StatisticsEventFlow> getByUniqueCode(String uniqueCode) {
        return statisticsEventFlowReadDao.getByUniqueCode(uniqueCode);
    }

    @Override
    public List<StatisticsEventFlow> findByEventId(String eventId, Map<String, Object> params) {
        return statisticsEventFlowReadDao.findByEventId(eventId, params);

    }

    @Override
    public StatisticsEventFlow getNewFlow(String uniqueCode) {
        return statisticsEventFlowReadDao.getNewFlow(uniqueCode);
    }

    @Override
    public List<StatisticsEventFlow> queryEventBydate(String startDate, String endDate, int pageNum, int pageSize) {
        return statisticsEventFlowReadDao.queryEventBydate(startDate, endDate, pageNum, pageSize);
    }

    @Override
    public int queryEventTotalNumByDate(String startDate, String endDate) {
        return statisticsEventFlowReadDao.queryEventTotalNumByDate(startDate, endDate);
    }

    @Override
    public List<StatisticsEventFlow> queryEventFlowListByDate(String queryDate, Page page) {
        return statisticsEventFlowReadDao.queryEventFlowListByDate(queryDate, page);
    }

    @Override
    public int queryEventFlowCountByDate(String queryDate, Integer total) {
        return statisticsEventFlowReadDao.queryEventFlowCountByDate(queryDate, total);
    }

    @Override
    public void deleteEventFlowByQueryDate(String queryDate, Integer total) {
        statisticsEventFlowWriteDao.deleteEventFlowByQueryDate(queryDate, total);
    }
}
